using System;
using System.BusinessObjects.Transactions;
using Blazing.BusinessObjects.Tagging;
using NHibernate;
using NHibernate.Criterion;

namespace Blazing.BusinessObjects.Queries
{
    public class QrySearchTagsByTaxonomy
    {
        public static IQuery Query(int taxonomyId)
        {
            string nql = "select t from Tag t where t in (select tt.Tag.ID from TaxonomyTag tt where tt.Taxonomy.ID=:taxonomyId)";
            IQuery qry = UnitOfWork.CurrentSession.CreateQuery(nql);
            qry.SetInt32("taxonomyId", taxonomyId);
            return qry;
        }
    }
}
